package com.jiyun.controller;

import com.baomidou.mybatisplus.core.metadata.PageList;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jiyun.pojo.ThTour;
import common.dtos.PageDto;
import common.dtos.PageRequestDto;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.jiyun.service.IThTourService;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  巡店任务
 * </p>
 *
 * @author usian
 * @since 2022-10-27
 */
@RestController
@RequestMapping("/tour")
@Api(tags = "接口")
@CrossOrigin
public class ThTourController{

    @Autowired
    private IThTourService thTourService;

    /**
     * 添加巡店任务
     */
    @PostMapping("/addTour")
    public String addTour(@RequestBody ThTour thTour){
        boolean save = thTourService.save(thTour);
        if (save){
            return "添加巡店任务成功";
        }else {
            return "添加巡店任务失败";
        }
    }

    @PostMapping("/findPage")
    public List<ThTour> page(@RequestBody PageDto dto){

        return thTourService.findPage(dto);
    }


}
